<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>人脸识别</title>
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
#include("/view/config.html")
</head>
<body>

<div class="container">

	<form id="form" style="margin-top: 200px">
		<div class="form-group">
			<label for="">姓名：</label>
			<input class="form-control" id="name" name="name">
		</div>
	
		<div>
			<label for="">身份证：</label>
		 	<input class="form-control" id="card" name="card">
		</div>
		</form>
	
	<button style="margin-top: 50px" id="submit" type="button" class="btn btn-primary btn-lg btn-block">提 交</button>

</div>

<script type="text/javascript">

$(function() {
	var module = function() {
		//包含常量及url的地址
		var configs = {
			
			ajax: {
				test: '/m/test',
				save: '/test/save'
			}
		}
		//接口数据
		var datas = {
			ajax: function(para) {
				if(!para) para = {}
                if(!para.data) para.data = {}
                para.data.fullget = true
				
				return $.FAjax(para).done(function(res) {
					if (res.status != 'ok') console.log(para.url + ':' + JSON.stringify(res));
				})
			},
			/*queryAppList: function(para) {
                para.url = configs[arguments.callee.name]
                return this.ajax(para)
            },*/
		}
		
		//动态生成ajax接口
		for(var key in configs.ajax) {
			datas[key] = function(para) {
				if(!para) para = {}
				para.url = global.cxt + configs.ajax[key]
				return this.ajax(para)
			}
		}
		
		//数据处理及模块中方法处理
		var handlers = {
			
		}
		//事件处理
		this.events = function() {
			$('body').on('click', '#submit', function() {
				datas.save({
					data: $('#form').serialize()
				}).done(function(res) {
					location.href = global.cxt + "/test/verify"
				})
			})
			return this
		}
	};
	
	new module().events()
})


</script>

</body>
</html>